package cn.kgc.auto.boot.controller;

import cn.kgc.auto.boot.entity.User;
import cn.kgc.auto.boot.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 课工场
 * @date 2024/8/16
 * @description
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Resource
    private UserService userService;

    // 查询员工列表
    @GetMapping("list")
    public List<User> empList() {
        return userService.list();
    }

    @GetMapping("getOne")
    public User empOne(Integer id) {
        return userService.getById(id);
    }

    @GetMapping("delete")
    public Boolean  deleteUser(Integer id){

        return userService.removeById(id);
    }
}
